<?php
/*
Plugin Name: RecentPosts
Plugin URI: http://www.yhustc.com/
Description: 最新日志
Author: yhustc
Version: 1.0
Author URI: http://www.yhustc.com/
*/

class RecentPostsWidget extends Widget
{
	function render($data=array())
	{
		$recentPosts = S("recentPosts");
		if(!$recentPosts)
		{
			$Dao = D("Posts");
			$recentPosts = $Dao->field("ID,post_title,post_name")->order("post_date DESC")->top5("post_type='post' AND post_status='publish'");
			S("recentPosts",$recentPosts);
		}

		$this->assign("recentPosts",$recentPosts);
		return $this->renderFile();
	}
}
?>